let href = decodeURI(location.href)
let couponId = href.split('?')[1].split('=')[1];
console.log(couponId);

fetch('http://chst.vip:1234/api/getcouponproduct?couponid='+couponId)
.then(function(a){
    return a.json();
})
.then(function(b){
    console.log(b);
    let str = '';
    b.result.forEach(item => {
            str += `<li couponProductId=${item.couponProductId}>
                        ${item.couponProductImg}
                        <div>
                            <p>${item.couponProductName}</p>
                            <p>${item.couponProductPrice}</p>
                            <p>${item.couponProductTime}</p>
                        </div>
                    </li>`
        
    });
    $('ul').html(str)
})
.then(function(){
    $('ul').on('click','li',function(){
        let couponProductImg = $(this).find('img');
        $('section div').html(couponProductImg);
        $('section').attr('display','flex')
    })
})